#include <iostream>
#include <string>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
const std::string terminal = "/dev/pts/0";
using namespace std;

int OpenTerminal()
{
    int fd = open(terminal.c_str(), O_WRONLY);
    if (fd < 0)
    {
        std::cerr << "open terminal error" << std::endl;
        exit(1);
    }
    //cout << fd << endl;
    dup2(fd, 2); // 重定向标准错误到/dev/pts/0
    return 0;
}
